// 统一管理所有接口的文件
// 获取真实服务器的接口数据利用当前axios
import request from './request'
// 获取mock接口的数据  利用下面axios
import mockRequest from './mockRequest'
// 商品列表接口
export const reqCategoryList = () =>{
    return request({url:'/product/getBaseCategoryList',method: 'GET'})
}
// 首页轮播图接口
export const reqGetBannerList = () =>{
    return mockRequest({url:'/banner',method: 'GET'})
}
// Floor组件轮播图接口
export const reqGetFloorList = () => {
    return mockRequest({url:'/floor',method: 'GET'})
}
// 搜索商品接口
export const reqGetSearchList = (data) => {
    return request({url:'/list',method:'POST',data})
}
// 获取产品详情的接口  api/item/{skuId}  get
export const reqGetDetailList = (skuId) => request({url:`/item/${skuId}`,method: 'GET'}) 

// 添加购物车接口 /api/cart/addToCart/{ skuId }/{ skuNum } POST
export const reqAddOrUpdateShopCart = (skuId,skuNum) => request({url:`/cart/addToCart/${skuId}/${skuNum}`,method: 'POST'})

// 获取购物车数据 /api/cart/cartList get  无参数
export const reqShopCartList = () => request({url:'/cart/cartList',method: 'GET'})

//删除购物车某一个产品的接口
///api/cart/deleteCart/{skuId}  delete 
export const reqDeleteCartById = (skuId)=>request({url:`/cart/deleteCart/${skuId}`,method:'DELETE'});

//修改某一个产品的选中状态接口
//api/cart/checkCart/{skuId}/{isChecked}  get 
//需要注意：从文档拷贝过来路径skuId小写的
export const reqUpdateCartChecked = (skuId,isChecked)=>request({url:`/cart/checkCart/${skuId}/${isChecked}`,method:'GET'});

//用户获取到验证码的接口
///api/user/passport/sendCode/{phone}  get 
export const reqCode = (phone)=>request({url:`/user/passport/sendCode/${phone}`,method:'GET'});

//注册用户接口
//api/user/passport/register  post  phone code password
export const reqRegister = (phone,code,password)=>request({url:`/user/passport/register`,method:'POST',data:{phone,code,password}});

//登录接口
///api/user/passport/login  post phone password
export const reqLogin = (phone,password)=>request({url:`/user/passport/login`,method:'POST',data:{phone,password}});


//获取用户信息的接口
//api/user/passport/auth/getUserInfo  get
export const reqUserInfo = ()=>request({url:`/user/passport/auth/getUserInfo`,method:'GET'});


//退出登录的接口【通知服务器销毁当前token身份】
///api/user/passport/logout  get 
export const reqLogout = ()=>request({url:`/user/passport/logout`,method:'GET'});

//获取用户地址信息
// /api/user/userAddress/auth/findUserAddressList   get
export const reqUserAddressInfo = () =>request({url:'/user/userAddress/auth/findUserAddressList',method:'GET'});

// 获取购物订单信息
// /api/order/auth/trade  get
export const reqShopOrderInfo = () =>request({url:'/order/auth/trade',method:'GET'});
